Skip to content

Add Run Matching admin page - #155

Open
Khai189 wants to merge 2 commits into
mainfrom
feature/run-matching-commit
Open

Khai189 wants to merge 2 commits into
mainfrom
feature/run-matching-commit

Conversation

@Khai189

@Khai189 Khai189 commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Context

Adds the admin UI for triggering the ride-matching algorithm, which now runs as a real service (deployed in aspc-website-v2, see that repo's PR #254) instead of a local CLI script. This PR only adds the frontend page + proxy routes; it does not touch the algorithm itself.

Describe your changes

  • frontend/src/app/admin/matching/page.tsx — new /admin/matching route, behind the existing admin auth layout.
  • frontend/src/components/admin/MatchingAlgorithm.tsx — "Run Matching" UI. Always pulls riders from the database (no manual/preview mode) and commits the result directly via the service's /run endpoint, which writes groups/matches to Supabase and consumes vouchers. Shows a confirmation dialog before running, since this is not undoable or previewable from here.
  • frontend/src/app/api/admin/matching/run/route.ts and .../status/route.ts — server-only proxy routes. The browser never talks to the algorithm service directly; these forward to ALGORITHM_SERVICE_URL with ALGORITHM_SERVICE_API_KEY.
  • frontend/src/components/admin/AdminDashboard.tsx — added a "Run Matching Algorithm" button next to "View & Manage Groups".
  • frontend/.env.example — documents the two new server-only env vars and how they map to aspc-website-v2's ML_PROXY_API_KEY secret.

Before this works in prod: ALGORITHM_SERVICE_URL and ALGORITHM_SERVICE_API_KEY need to be set in this project's Vercel settings, once aspc-website-v2's PR #254 is deployed.

Testing

  • Type/lint/format: tsc --noEmit, eslint, and prettier --check all clean on every changed file.
  • Unit tests: 264/264 existing Jest tests passing (unchanged by this PR). Note: this feature has no dedicated automated tests yet — verified manually via a local build pointed at the admin layout and the service's status/run endpoints.
  • Manual: walked through the status banner's three states (not configured / unreachable / no DB creds) and the confirm-dialog gate by pointing a local build at a running copy of the ml_microservice.

Rebuilt on current main after the frontend/ML monorepo merge — the
original commits were based on the pre-merge root-level layout.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@netlify

netlify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for p-ickup ready!

Name Link
🔨 Latest commit cf6f291
🔍 Latest deploy log https://app.netlify.com/projects/p-ickup/deploys/6ae2b65d9054e99c1487edd4
😎 Deploy Preview https://deploy-preview-155--p-ickup.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Khai189
Khai189 requested a balanced review from Copilot October 29, 2026 02:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants